home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-05 | 6.6 KB | 187 lines | [TEXT/MPS ] |
- Notes on the Macintosh Port of Gofer, Version 0.22d
- ===================================================
-
- Kevin Hammond, Glasgow University, 5th May 1994
-
-
- Copyright
- ---------
-
- These sources are Copyright © 1991-1994. The copyright to portions of the
- source code is owned by
-
- Mark Jones, Yale University
- Kevin Hammond, Glasgow University
- Humayan Lari, University of North Carolina
- Manuel Veloso, Allston, MA
-
- and Glasgow University on behalf of Matthew Smith, Alex Stewart
- and Desmond Yip
-
-
- Licence
- -------
-
- Please see the file "goferite.h" for the general licence and conditions
- of use of this source code.
-
-
- The Sources
- -----------
-
- The files in this directory are the sources for MacGofer and for the
- MPW tool version of Gofer. I recommend you use the standalone version,
- the tool can be rather frustrating! To compile these sources you will
- need:
-
- MPW shell, Assembler and C compiler version 3.2 or later
-
- Think C will not do! I tried, but the lack of intra-file segmenting
- meant that kind.c/preds.c/type.c would need to be entirely rewritten.
- Everything else should compile OK, but I haven't checked this recently.
-
- Mac-specific source files are mac_*; other source files are derived from
- the Gofer 2.28b distribution. There are a few special files.
-
- MacGofer.rez contains a Rez template for the MacGofer resources.
- Can be compiled using rez to generate MacGofer.r
-
- MacGofer.r contains the resources for MacGofer. Edit this
- using ResEdit
-
- MacGofer.make is the makefile. Use the MPW build command for
- MacGofer to build the application, or rename
- it to Gofer.make and build Gofer to make the
- MPW tool.
-
- mac.h is the main header file for MacGofer.
-
- mac_humayan_utils.[ch] are some utilities written by Humayan Lari
- to make integrating with the toolbox easier.
-
- mac_trap.a is the "ccall" implementation using self-modifying
- assembly code.
-
- mac_SFMultiGet.c is source code for a multi-file standard file
- dialog, used in Load File… This was borrowed
- from the net.
-
- mac_StrInit.c is the code for initialising strings from the
- string resources held in MacGofer.
-
- The other sources should have fairly obvious names. Note that parser.y has
- been changed so that buildTuple is exported. This proved to be useful in
- prims.c.
-
-
- Compiling MacGofer
- ------------------
-
- You should be able to build MacGofer with a standard MPW setup. The
- build directory needs about 3M on my system, including 700K for the
- .SYM file. If you don't expect to spend time in the debugger, you
- should set SYM = -sym off in the makefile -- this will significantly
- speed up compilation and linking, which will otherwise take around
- ~30 minutes for a complete rebuild on my SE/30.
-
-
- Using MPW Tool Versions
- -----------------------
-
- The files Gofc.make and Gofer.make are provided so that MPW Tool versions
- of the Gofer compiler and interpreter can be built. MacGofer does not
- provide the compiler facilities of gofc.
-
- To run the compiler/interpreter, you may find you need to change the
- default memory settings (-mx flags). With a 2M partition for the MPW
- shell, I found I needed to use -ma8000 if I was to avoid the program
- memory exhausted message. Larger partitions may be necessary in order
- to compile or run large programs.
-
-
- Changes to the Standard Sources
- -------------------------------
-
- By default, MacGofer is compiled with simple tracing on, and with the
- special monad syntax in Gofer 2.28, but without the experimental
- lambdavar extensions. It uses 32-bit Ints and Floats.
-
- There are many places where changes have been made in order to build
- an interface around the Gofer interpreter. Obviously, the command
- interface has needed to be changed, but there are also some other
- important but less obvious differences:
-
- o Explicit recursion stack overflow checking is performed.
- Without this, MacGofer would crash inexplicably during deep
- calls to the typechecker etc. You can increase the stack by
- changing a STR resource.
-
- o Because Gofer garbage collects off the C stack, the program is
- VERY sensitive to stack alignment. IF YOU CHANGE ANYTHING WHICH
- CALLS A GOFER ROUTINE WHICH MIGHT GARBAGE COLLECT, YOU MUST MAKE
- SURE THAT THE STACK FRAME IS INCREMENTED BY A LONGWORD NUMBER OF
- BYTES. It is not sufficient to do this by source inspection --
- the MPW C compiler is clever enough to reuse stack locations, and
- to registerise local variables when possible (this could actually
- cause problems for the garbage collector too!). Use the dumpobj
- command from MPW to inspect the object code, and look for LINK
- instructions. Float and Bool values are especially problematic.
- The files affected are machdep.c, prims.c, input.c and machine.c
-
- o For a similar reason, the Float primitive code has had to be written
- VERY carefully. Follow the rules given in machine.c when changing
- this!
-
- o Standard I/O routines have been rewritten to read from/write to the
- worksheet when appropriate (see mac_io.c). Note that this version
- of printf is incomplete, and may fail if a char rather than an int
- is printed using %c for example.
-
- o MacGofer buffers keyboard events internally, so that they can be
- used either by getchar, or by a call to getNextEvent in a program
- which interfaces with the toolbox (see mac_io.c).
-
- o Gofer now checks for EOF at places other than end-of-line. On the
- Mac, EOF can occur anywhere!
-
- o Fatal Gofer errors don't bomb out of the application, but return
- you to the prompt.
-
- o Heap sizes etc. are not compiled in, but can be changed by the user.
- Sizes have to be fixed across a single session, however.
-
- o The full 8-bit Mac character set is supported in the standard
- fonts, by replacing ctype by a special version.
-
- o You can change the Prelude. Users kept complaining about needing
- to exit and restart with Mark's design.
-
- o Scoping has been changed for some local functions, e.g. buildTuple
- in parser.y
-
- o sinh, asinh, etc. primitives have been defined. There didn't
- seem a good reason to exclude these.
-
- o Gofer supports Hex constants of the form 0x... plus some primitive
- bit-manipulating functions.
-
-
- Making Changes etc.
- -------------------
-
- Please contact me (Kevin Hammond: kh@dcs.glasgow.ac.uk) if you wish to
- incorporate your changes into the main distribution, or wish to obtain
- permission to distribute MacGofer in any other fashion.
-
- The latest version of the source and binaries can be obtained from
-
- ftp.dcs.glasgow.ac.uk [130.209.240.50]
- in pub/haskell/gofer/macgofer
-
- Note that MacGofer is supported entirely from my (very) limited free time.
- While I will try to fix serious bugs and respond to email as rapidly
- as possible, it is not reasonable for you to expect commercial levels
- of support!
-
- Kevin
-